C#########################################################
C This file is part of OpenAD released under the LGPL.   #
C The full COPYRIGHT notice can be found in the top      #
C level directory of the OpenAD distribution             #
C#########################################################
C
C$OPENAD XXX File_start [head.f]
      SUBROUTINE head(X, F)
          use OAD_tape
          use OAD_rev
          use OAD_cp

C original arguments get inserted before version
C         ! and declared here together with all local variables
C         ! generated by xaifBooster

      use OAD_active
      use w2f__types
      use oad_intrinsics
      use oad_intrinsics
      use oad_intrinsics
      IMPLICIT NONE
C
C     **** Global Variables & Derived Type Definitions ****
C
      INTEGER(w2f__i8) OpenAD_Symbol_0
      INTEGER(w2f__i8) OpenAD_Symbol_1
      INTEGER(w2f__i8) OpenAD_Symbol_2
      INTEGER(w2f__i8) OpenAD_Symbol_3
      INTEGER(w2f__i8) OpenAD_Symbol_4
      INTEGER(w2f__i8) OpenAD_Symbol_5
C
C     **** Parameters and Result ****
C
      type(active) :: X(1:9)
      type(active) :: F(1:7)
C
C     **** Local Variables and Functions ****
C
      REAL(w2f__8) H
      INTEGER(w2f__i4) I
      INTEGER(w2f__i4) OpenAD_Symbol_10
      INTEGER(w2f__i4) OpenAD_Symbol_11
      INTEGER(w2f__i4) OpenAD_Symbol_12
      INTEGER(w2f__i4) OpenAD_Symbol_13
      INTEGER(w2f__i4) OpenAD_Symbol_14
      INTEGER(w2f__i4) OpenAD_Symbol_15
      INTEGER(w2f__i4) OpenAD_Symbol_16
      INTEGER(w2f__i4) OpenAD_Symbol_17
      REAL(w2f__8) OpenAD_Symbol_18
      REAL(w2f__8) OpenAD_Symbol_19
      REAL(w2f__8) OpenAD_Symbol_20
      REAL(w2f__8) OpenAD_Symbol_21
      REAL(w2f__8) OpenAD_Symbol_22
      REAL(w2f__8) OpenAD_Symbol_23
      REAL(w2f__8) OpenAD_Symbol_24
      REAL(w2f__8) OpenAD_Symbol_25
      INTEGER(w2f__i4) OpenAD_Symbol_26
      REAL(w2f__8) OpenAD_Symbol_27
      REAL(w2f__8) OpenAD_Symbol_28
      REAL(w2f__8) OpenAD_Symbol_29
      REAL(w2f__8) OpenAD_Symbol_30
      INTEGER(w2f__i4) OpenAD_Symbol_31
      INTEGER(w2f__i4) OpenAD_Symbol_32
      INTEGER(w2f__i4) OpenAD_Symbol_33
      INTEGER(w2f__i4) OpenAD_Symbol_34
      INTEGER(w2f__i4) OpenAD_Symbol_35
      INTEGER(w2f__i4) OpenAD_Symbol_36
      REAL(w2f__8) OpenAD_Symbol_37
      REAL(w2f__8) OpenAD_Symbol_38
      REAL(w2f__8) OpenAD_Symbol_39
      REAL(w2f__8) OpenAD_Symbol_40
      INTEGER(w2f__i4) OpenAD_Symbol_41
      REAL(w2f__8) OpenAD_Symbol_42
      REAL(w2f__8) OpenAD_Symbol_43
      REAL(w2f__8) OpenAD_Symbol_44
      REAL(w2f__8) OpenAD_Symbol_45
      INTEGER(w2f__i4) OpenAD_Symbol_46
      INTEGER(w2f__i4) OpenAD_Symbol_47
      INTEGER(w2f__i4) OpenAD_Symbol_48
      INTEGER(w2f__i4) OpenAD_Symbol_49
      INTEGER(w2f__i4) OpenAD_Symbol_50
      INTEGER(w2f__i4) OpenAD_Symbol_51
      INTEGER(w2f__i4) OpenAD_Symbol_52
      REAL(w2f__8) OpenAD_Symbol_53
      REAL(w2f__8) OpenAD_Symbol_54
      REAL(w2f__8) OpenAD_Symbol_55
      REAL(w2f__8) OpenAD_Symbol_56
      REAL(w2f__8) OpenAD_Symbol_57
      REAL(w2f__8) OpenAD_Symbol_58
      REAL(w2f__8) OpenAD_Symbol_59
      INTEGER(w2f__i4) OpenAD_Symbol_6
      REAL(w2f__8) OpenAD_Symbol_60
      INTEGER(w2f__i4) OpenAD_Symbol_7
      INTEGER(w2f__i4) OpenAD_Symbol_8
      INTEGER(w2f__i4) OpenAD_Symbol_9
      REAL(w2f__8) OpenAD_acc_0
      REAL(w2f__8) OpenAD_acc_1
      REAL(w2f__8) OpenAD_acc_10
      REAL(w2f__8) OpenAD_acc_11
      REAL(w2f__8) OpenAD_acc_12
      REAL(w2f__8) OpenAD_acc_13
      REAL(w2f__8) OpenAD_acc_14
      REAL(w2f__8) OpenAD_acc_15
      REAL(w2f__8) OpenAD_acc_16
      REAL(w2f__8) OpenAD_acc_17
      REAL(w2f__8) OpenAD_acc_18
      REAL(w2f__8) OpenAD_acc_19
      REAL(w2f__8) OpenAD_acc_2
      REAL(w2f__8) OpenAD_acc_20
      REAL(w2f__8) OpenAD_acc_21
      REAL(w2f__8) OpenAD_acc_22
      REAL(w2f__8) OpenAD_acc_23
      REAL(w2f__8) OpenAD_acc_24
      REAL(w2f__8) OpenAD_acc_25
      REAL(w2f__8) OpenAD_acc_26
      REAL(w2f__8) OpenAD_acc_27
      REAL(w2f__8) OpenAD_acc_28
      REAL(w2f__8) OpenAD_acc_29
      REAL(w2f__8) OpenAD_acc_3
      REAL(w2f__8) OpenAD_acc_30
      REAL(w2f__8) OpenAD_acc_31
      REAL(w2f__8) OpenAD_acc_32
      REAL(w2f__8) OpenAD_acc_33
      REAL(w2f__8) OpenAD_acc_34
      REAL(w2f__8) OpenAD_acc_35
      REAL(w2f__8) OpenAD_acc_36
      REAL(w2f__8) OpenAD_acc_37
      REAL(w2f__8) OpenAD_acc_38
      REAL(w2f__8) OpenAD_acc_39
      REAL(w2f__8) OpenAD_acc_4
      REAL(w2f__8) OpenAD_acc_40
      REAL(w2f__8) OpenAD_acc_41
      REAL(w2f__8) OpenAD_acc_5
      REAL(w2f__8) OpenAD_acc_6
      REAL(w2f__8) OpenAD_acc_7
      REAL(w2f__8) OpenAD_acc_8
      REAL(w2f__8) OpenAD_acc_9
      REAL(w2f__8) OpenAD_aux_0
      REAL(w2f__8) OpenAD_aux_1
      REAL(w2f__8) OpenAD_aux_10
      REAL(w2f__8) OpenAD_aux_11
      REAL(w2f__8) OpenAD_aux_12
      REAL(w2f__8) OpenAD_aux_13
      REAL(w2f__8) OpenAD_aux_14
      REAL(w2f__8) OpenAD_aux_15
      REAL(w2f__8) OpenAD_aux_16
      REAL(w2f__8) OpenAD_aux_17
      REAL(w2f__8) OpenAD_aux_18
      REAL(w2f__8) OpenAD_aux_19
      REAL(w2f__8) OpenAD_aux_2
      REAL(w2f__8) OpenAD_aux_20
      REAL(w2f__8) OpenAD_aux_21
      REAL(w2f__8) OpenAD_aux_22
      REAL(w2f__8) OpenAD_aux_23
      REAL(w2f__8) OpenAD_aux_24
      REAL(w2f__8) OpenAD_aux_25
      REAL(w2f__8) OpenAD_aux_26
      REAL(w2f__8) OpenAD_aux_27
      REAL(w2f__8) OpenAD_aux_28
      REAL(w2f__8) OpenAD_aux_29
      REAL(w2f__8) OpenAD_aux_3
      REAL(w2f__8) OpenAD_aux_30
      REAL(w2f__8) OpenAD_aux_31
      REAL(w2f__8) OpenAD_aux_32
      REAL(w2f__8) OpenAD_aux_33
      REAL(w2f__8) OpenAD_aux_34
      REAL(w2f__8) OpenAD_aux_35
      REAL(w2f__8) OpenAD_aux_36
      REAL(w2f__8) OpenAD_aux_4
      REAL(w2f__8) OpenAD_aux_5
      REAL(w2f__8) OpenAD_aux_6
      REAL(w2f__8) OpenAD_aux_7
      REAL(w2f__8) OpenAD_aux_8
      REAL(w2f__8) OpenAD_aux_9
      REAL(w2f__8) OpenAD_lin_0
      REAL(w2f__8) OpenAD_lin_1
      REAL(w2f__8) OpenAD_lin_10
      REAL(w2f__8) OpenAD_lin_11
      REAL(w2f__8) OpenAD_lin_12
      REAL(w2f__8) OpenAD_lin_13
      REAL(w2f__8) OpenAD_lin_14
      REAL(w2f__8) OpenAD_lin_15
      REAL(w2f__8) OpenAD_lin_16
      REAL(w2f__8) OpenAD_lin_17
      REAL(w2f__8) OpenAD_lin_18
      REAL(w2f__8) OpenAD_lin_19
      REAL(w2f__8) OpenAD_lin_2
      REAL(w2f__8) OpenAD_lin_20
      REAL(w2f__8) OpenAD_lin_21
      REAL(w2f__8) OpenAD_lin_22
      REAL(w2f__8) OpenAD_lin_23
      REAL(w2f__8) OpenAD_lin_24
      REAL(w2f__8) OpenAD_lin_25
      REAL(w2f__8) OpenAD_lin_26
      REAL(w2f__8) OpenAD_lin_27
      REAL(w2f__8) OpenAD_lin_28
      REAL(w2f__8) OpenAD_lin_29
      REAL(w2f__8) OpenAD_lin_3
      REAL(w2f__8) OpenAD_lin_30
      REAL(w2f__8) OpenAD_lin_31
      REAL(w2f__8) OpenAD_lin_32
      REAL(w2f__8) OpenAD_lin_33
      REAL(w2f__8) OpenAD_lin_34
      REAL(w2f__8) OpenAD_lin_35
      REAL(w2f__8) OpenAD_lin_36
      REAL(w2f__8) OpenAD_lin_37
      REAL(w2f__8) OpenAD_lin_38
      REAL(w2f__8) OpenAD_lin_39
      REAL(w2f__8) OpenAD_lin_4
      REAL(w2f__8) OpenAD_lin_40
      REAL(w2f__8) OpenAD_lin_41
      REAL(w2f__8) OpenAD_lin_42
      REAL(w2f__8) OpenAD_lin_43
      REAL(w2f__8) OpenAD_lin_44
      REAL(w2f__8) OpenAD_lin_45
      REAL(w2f__8) OpenAD_lin_46
      REAL(w2f__8) OpenAD_lin_47
      REAL(w2f__8) OpenAD_lin_48
      REAL(w2f__8) OpenAD_lin_49
      REAL(w2f__8) OpenAD_lin_5
      REAL(w2f__8) OpenAD_lin_50
      REAL(w2f__8) OpenAD_lin_51
      REAL(w2f__8) OpenAD_lin_52
      REAL(w2f__8) OpenAD_lin_53
      REAL(w2f__8) OpenAD_lin_54
      REAL(w2f__8) OpenAD_lin_55
      REAL(w2f__8) OpenAD_lin_56
      REAL(w2f__8) OpenAD_lin_57
      REAL(w2f__8) OpenAD_lin_58
      REAL(w2f__8) OpenAD_lin_59
      REAL(w2f__8) OpenAD_lin_6
      REAL(w2f__8) OpenAD_lin_60
      REAL(w2f__8) OpenAD_lin_61
      REAL(w2f__8) OpenAD_lin_62
      REAL(w2f__8) OpenAD_lin_7
      REAL(w2f__8) OpenAD_lin_8
      REAL(w2f__8) OpenAD_lin_9
      type(active) :: OpenAD_prp_0
      type(active) :: OpenAD_prp_1
      type(active) :: OpenAD_prp_2
      type(active) :: OpenAD_prp_3
      type(active) :: OpenAD_prp_4


C checkpointing stacks and offsets
          integer :: cp_loop_variable_1,cp_loop_variable_2,cp_loop_varia
     +ble_3,cp_loop_variable_4,cp_loop_variable_5,cp_loop_variable_6

C floats 'F'
          double precision, dimension(:), allocatable, save :: theArgFSt
     +ack
          integer, save :: theArgFStackoffset=0, theArgFStackSize=0
C integers 'I'
          integer, dimension(:), allocatable, save :: theArgIStack
          integer, save :: theArgIStackoffset=0, theArgIStackSize=0
C booleans 'B'
          logical, dimension(:), allocatable, save :: theArgBStack
          integer, save :: theArgBStackoffset=0, theArgBStackSize=0
C strings 'S'
          character*(80), dimension(:), allocatable, save :: theArgSStac
     +k
          integer, save :: theArgSStackoffset=0, theArgSStackSize=0

          type(modeType) :: our_orig_mode

C external C function used in inlined code
          integer iaddr
          external iaddr
C
C     **** Top Level Pragmas ****
C
C$OPENAD INDEPENDENT(X)
C$OPENAD DEPENDENT(F)
C
C     **** Statements ****
C

          if (our_rev_mode%arg_store) then
C store arguments
          end if
          if (our_rev_mode%arg_restore) then
C restore arguments
          end if
          if (our_rev_mode%plain) then
            our_orig_mode=our_rev_mode
            our_rev_mode%arg_store=.FALSE.
C original function
C$OPENAD XXX Template ad_template.f
      H = 2.5D-01
      F(1)%v = (X(1)%v*(-2.0D00)+((X(8)%v*H*H)/1.2D+01)*(EXP(X(1)%v/(X(1
     +)%v*X(9)%v+1.0D00))*1.0D+01+1.0D00))
      F(2)%v = (X(1)%v+EXP(X(1)%v/(X(1)%v*X(9)%v+1.0D00))*((X(8)%v*H*H)/
     +1.2D+01))
      DO I = 2,6,1
        F(I+(-1))%v = (X(I)%v+F(I+(-1))%v+EXP(X(I)%v/(X(I)%v*X(9)%v+1.0D
     +00))*((X(8)%v*H*H)/1.2D+01))
        F(INT(I))%v = (EXP(X(I)%v/(X(I)%v*X(9)%v+1.0D00))*((X(8)%v*H*H)/
     +1.19999999999999995559D00)+F(I)%v-X(I)%v*2.0D00)
        F(I+1)%v = (X(I)%v+EXP(X(I)%v/(X(I)%v*X(9)%v+1.0D00))*((X(8)%v*H
     +*H)/1.2D+01))
      END DO
      F(6)%v = (X(7)%v+F(6)%v+EXP(X(7)%v/(X(7)%v*X(9)%v+1.0D00))*((X(8)%
     +v*H*H)/1.2D+01))
      F(7)%v = (F(7)%v-X(7)%v*2.0D00)
      F(7)%v = (F(7)%v+((X(8)%v*H*H)/1.2D+01)*(EXP(X(7)%v/(X(7)%v*X(9)%v
     ++1.0D00))*1.0D+01+1.0D00))

C original function end
            our_rev_mode=our_orig_mode
          end if
          if (our_rev_mode%tape) then
C            print*, " tape       ", our_rev_mode
            our_rev_mode%arg_store=.TRUE.
            our_rev_mode%arg_restore=.FALSE.
            our_rev_mode%plain=.TRUE.
            our_rev_mode%tape=.FALSE.
            our_rev_mode%adjoint=.FALSE.
C taping
C$OPENAD XXX Template ad_template.f
      H = 2.5D-01
      OpenAD_aux_3 = (H*H)
      OpenAD_aux_2 = (X(8)%v*OpenAD_aux_3)
      OpenAD_aux_0 = (OpenAD_aux_2/1.2D+01)
      OpenAD_aux_5 = (X(1)%v*X(9)%v+1.0D00)
      OpenAD_aux_4 = EXP(X(1)%v/OpenAD_aux_5)
      OpenAD_aux_1 = (OpenAD_aux_4*1.0D+01+1.0D00)
      OpenAD_lin_3 = OpenAD_aux_3
      OpenAD_lin_2 = (INT(1_w2f__i8)/1.2D+01)
      OpenAD_lin_0 = OpenAD_aux_1
      OpenAD_lin_5 = (INT(1_w2f__i8)/OpenAD_aux_5)
      OpenAD_lin_7 = X(9)%v
      OpenAD_lin_8 = X(1)%v
      OpenAD_lin_6 = (-(X(1)%v/(OpenAD_aux_5*OpenAD_aux_5)))
      OpenAD_lin_4 = OpenAD_aux_4
      OpenAD_lin_1 = OpenAD_aux_0
      F(1)%v = (X(1)%v*(-2.0D00)+OpenAD_aux_0*OpenAD_aux_1)
      OpenAD_acc_0 = (OpenAD_lin_4*1.0D+01)
      OpenAD_acc_1 = (OpenAD_lin_3*OpenAD_lin_2*OpenAD_lin_0)
      OpenAD_acc_2 = (OpenAD_lin_5*OpenAD_acc_0*OpenAD_lin_1)
      OpenAD_acc_3 = (OpenAD_lin_6*OpenAD_acc_0*OpenAD_lin_1)
      OpenAD_acc_4 = (OpenAD_lin_7*OpenAD_acc_3)
      OpenAD_acc_5 = (OpenAD_lin_8*OpenAD_acc_3)
      double_tape(double_tape_pointer) = OpenAD_acc_1
      double_tape_pointer = double_tape_pointer+1
      double_tape(double_tape_pointer) = OpenAD_acc_2
      double_tape_pointer = double_tape_pointer+1
      double_tape(double_tape_pointer) = OpenAD_acc_4
      double_tape_pointer = double_tape_pointer+1
      double_tape(double_tape_pointer) = OpenAD_acc_5
      double_tape_pointer = double_tape_pointer+1
      OpenAD_aux_8 = (X(1)%v*X(9)%v+1.0D00)
      OpenAD_aux_6 = EXP(X(1)%v/OpenAD_aux_8)
      OpenAD_aux_10 = (H*H)
      OpenAD_aux_9 = (X(8)%v*OpenAD_aux_10)
      OpenAD_aux_7 = (OpenAD_aux_9/1.2D+01)
      OpenAD_lin_12 = (INT(1_w2f__i8)/OpenAD_aux_8)
      OpenAD_lin_14 = X(9)%v
      OpenAD_lin_15 = X(1)%v
      OpenAD_lin_13 = (-(X(1)%v/(OpenAD_aux_8*OpenAD_aux_8)))
      OpenAD_lin_11 = OpenAD_aux_6
      OpenAD_lin_9 = OpenAD_aux_7
      OpenAD_lin_17 = OpenAD_aux_10
      OpenAD_lin_16 = (INT(1_w2f__i8)/1.2D+01)
      OpenAD_lin_10 = OpenAD_aux_6
      F(2)%v = (X(1)%v+OpenAD_aux_6*OpenAD_aux_7)
      OpenAD_acc_6 = (OpenAD_lin_11*OpenAD_lin_9)
      OpenAD_acc_7 = (OpenAD_lin_17*OpenAD_lin_16*OpenAD_lin_10)
      OpenAD_acc_8 = (OpenAD_lin_12*OpenAD_acc_6)
      OpenAD_acc_9 = (OpenAD_lin_13*OpenAD_acc_6)
      OpenAD_acc_10 = (OpenAD_lin_14*OpenAD_acc_9)
      OpenAD_acc_11 = (OpenAD_lin_15*OpenAD_acc_9)
      double_tape(double_tape_pointer) = OpenAD_acc_7
      double_tape_pointer = double_tape_pointer+1
      double_tape(double_tape_pointer) = OpenAD_acc_8
      double_tape_pointer = double_tape_pointer+1
      double_tape(double_tape_pointer) = OpenAD_acc_10
      double_tape_pointer = double_tape_pointer+1
      double_tape(double_tape_pointer) = OpenAD_acc_11
      double_tape_pointer = double_tape_pointer+1
      OpenAD_Symbol_2 = 0_w2f__i8
      DO I = 2,6,1
        OpenAD_aux_13 = (X(I)%v*X(9)%v+1.0D00)
        OpenAD_aux_11 = EXP(X(I)%v/OpenAD_aux_13)
        OpenAD_aux_15 = (H*H)
        OpenAD_aux_14 = (X(8)%v*OpenAD_aux_15)
        OpenAD_aux_12 = (OpenAD_aux_14/1.2D+01)
        OpenAD_lin_21 = (INT(1_w2f__i8)/OpenAD_aux_13)
        OpenAD_lin_23 = X(9)%v
        OpenAD_lin_24 = X(I)%v
        OpenAD_lin_22 = (-(X(I)%v/(OpenAD_aux_13*OpenAD_aux_13)))
        OpenAD_lin_20 = OpenAD_aux_11
        OpenAD_lin_18 = OpenAD_aux_12
        OpenAD_lin_26 = OpenAD_aux_15
        OpenAD_lin_25 = (INT(1_w2f__i8)/1.2D+01)
        OpenAD_lin_19 = OpenAD_aux_11
        F(I+(-1))%v = (X(I)%v+F(I+(-1))%v+OpenAD_aux_11*OpenAD_aux_12)
        OpenAD_acc_12 = (OpenAD_lin_20*OpenAD_lin_18)
        OpenAD_acc_13 = (OpenAD_lin_26*OpenAD_lin_25*OpenAD_lin_19)
        OpenAD_acc_14 = (OpenAD_lin_21*OpenAD_acc_12)
        OpenAD_acc_15 = (OpenAD_lin_22*OpenAD_acc_12)
        OpenAD_acc_16 = (OpenAD_lin_23*OpenAD_acc_15)
        OpenAD_acc_17 = (OpenAD_lin_24*OpenAD_acc_15)
        OpenAD_Symbol_6 = (I+(-1))
        integer_tape(integer_tape_pointer) = OpenAD_Symbol_6
        integer_tape_pointer = integer_tape_pointer+1
        OpenAD_Symbol_7 = (I+(-1))
        integer_tape(integer_tape_pointer) = OpenAD_Symbol_7
        integer_tape_pointer = integer_tape_pointer+1
        OpenAD_Symbol_8 = (I+(-1))
        integer_tape(integer_tape_pointer) = OpenAD_Symbol_8
        integer_tape_pointer = integer_tape_pointer+1
        double_tape(double_tape_pointer) = OpenAD_acc_13
        double_tape_pointer = double_tape_pointer+1
        OpenAD_Symbol_9 = (I+(-1))
        integer_tape(integer_tape_pointer) = OpenAD_Symbol_9
        integer_tape_pointer = integer_tape_pointer+1
        double_tape(double_tape_pointer) = OpenAD_acc_14
        double_tape_pointer = double_tape_pointer+1
        OpenAD_Symbol_10 = (I+(-1))
        integer_tape(integer_tape_pointer) = OpenAD_Symbol_10
        integer_tape_pointer = integer_tape_pointer+1
        double_tape(double_tape_pointer) = OpenAD_acc_16
        double_tape_pointer = double_tape_pointer+1
        OpenAD_Symbol_11 = (I+(-1))
        integer_tape(integer_tape_pointer) = OpenAD_Symbol_11
        integer_tape_pointer = integer_tape_pointer+1
        double_tape(double_tape_pointer) = OpenAD_acc_17
        double_tape_pointer = double_tape_pointer+1
        OpenAD_Symbol_12 = (I+(-1))
        integer_tape(integer_tape_pointer) = OpenAD_Symbol_12
        integer_tape_pointer = integer_tape_pointer+1
        integer_tape(integer_tape_pointer) = I
        integer_tape_pointer = integer_tape_pointer+1
        OpenAD_aux_18 = (X(I)%v*X(9)%v+1.0D00)
        OpenAD_aux_16 = EXP(X(I)%v/OpenAD_aux_18)
        OpenAD_aux_20 = (H*H)
        OpenAD_aux_19 = (X(8)%v*OpenAD_aux_20)
        OpenAD_aux_17 = (OpenAD_aux_19/1.19999999999999995559D00)
        OpenAD_lin_30 = (INT(1_w2f__i8)/OpenAD_aux_18)
        OpenAD_lin_32 = X(9)%v
        OpenAD_lin_33 = X(I)%v
        OpenAD_lin_31 = (-(X(I)%v/(OpenAD_aux_18*OpenAD_aux_18)))
        OpenAD_lin_29 = OpenAD_aux_16
        OpenAD_lin_27 = OpenAD_aux_17
        OpenAD_lin_35 = OpenAD_aux_20
        OpenAD_lin_34 = (INT(1_w2f__i8)/1.19999999999999995559D00)
        OpenAD_lin_28 = OpenAD_aux_16
        F(INT(I))%v = (OpenAD_aux_16*OpenAD_aux_17+F(I)%v-X(I)%v*2.0D00)
        OpenAD_acc_18 = (OpenAD_lin_29*OpenAD_lin_27)
        OpenAD_acc_19 = (OpenAD_lin_35*OpenAD_lin_34*OpenAD_lin_28)
        OpenAD_acc_20 = (OpenAD_lin_30*OpenAD_acc_18)
        OpenAD_acc_21 = (OpenAD_lin_31*OpenAD_acc_18)
        OpenAD_acc_22 = (OpenAD_lin_32*OpenAD_acc_21)
        OpenAD_acc_23 = (OpenAD_lin_33*OpenAD_acc_21)
        double_tape(double_tape_pointer) = OpenAD_acc_19
        double_tape_pointer = double_tape_pointer+1
        double_tape(double_tape_pointer) = OpenAD_acc_20
        double_tape_pointer = double_tape_pointer+1
        double_tape(double_tape_pointer) = OpenAD_acc_22
        double_tape_pointer = double_tape_pointer+1
        double_tape(double_tape_pointer) = OpenAD_acc_23
        double_tape_pointer = double_tape_pointer+1
        integer_tape(integer_tape_pointer) = I
        integer_tape_pointer = integer_tape_pointer+1
        OpenAD_aux_23 = (X(I)%v*X(9)%v+1.0D00)
        OpenAD_aux_21 = EXP(X(I)%v/OpenAD_aux_23)
        OpenAD_aux_25 = (H*H)
        OpenAD_aux_24 = (X(8)%v*OpenAD_aux_25)
        OpenAD_aux_22 = (OpenAD_aux_24/1.2D+01)
        OpenAD_lin_39 = (INT(1_w2f__i8)/OpenAD_aux_23)
        OpenAD_lin_41 = X(9)%v
        OpenAD_lin_42 = X(I)%v
        OpenAD_lin_40 = (-(X(I)%v/(OpenAD_aux_23*OpenAD_aux_23)))
        OpenAD_lin_38 = OpenAD_aux_21
        OpenAD_lin_36 = OpenAD_aux_22
        OpenAD_lin_44 = OpenAD_aux_25
        OpenAD_lin_43 = (INT(1_w2f__i8)/1.2D+01)
        OpenAD_lin_37 = OpenAD_aux_21
        F(I+1)%v = (X(I)%v+OpenAD_aux_21*OpenAD_aux_22)
        OpenAD_acc_24 = (OpenAD_lin_38*OpenAD_lin_36)
        OpenAD_acc_25 = (OpenAD_lin_44*OpenAD_lin_43*OpenAD_lin_37)
        OpenAD_acc_26 = (OpenAD_lin_39*OpenAD_acc_24)
        OpenAD_acc_27 = (OpenAD_lin_40*OpenAD_acc_24)
        OpenAD_acc_28 = (OpenAD_lin_41*OpenAD_acc_27)
        OpenAD_acc_29 = (OpenAD_lin_42*OpenAD_acc_27)
        OpenAD_Symbol_13 = (I+1)
        integer_tape(integer_tape_pointer) = OpenAD_Symbol_13
        integer_tape_pointer = integer_tape_pointer+1
        double_tape(double_tape_pointer) = OpenAD_acc_25
        double_tape_pointer = double_tape_pointer+1
        OpenAD_Symbol_14 = (I+1)
        integer_tape(integer_tape_pointer) = OpenAD_Symbol_14
        integer_tape_pointer = integer_tape_pointer+1
        double_tape(double_tape_pointer) = OpenAD_acc_26
        double_tape_pointer = double_tape_pointer+1
        OpenAD_Symbol_15 = (I+1)
        integer_tape(integer_tape_pointer) = OpenAD_Symbol_15
        integer_tape_pointer = integer_tape_pointer+1
        double_tape(double_tape_pointer) = OpenAD_acc_28
        double_tape_pointer = double_tape_pointer+1
        OpenAD_Symbol_16 = (I+1)
        integer_tape(integer_tape_pointer) = OpenAD_Symbol_16
        integer_tape_pointer = integer_tape_pointer+1
        double_tape(double_tape_pointer) = OpenAD_acc_29
        double_tape_pointer = double_tape_pointer+1
        OpenAD_Symbol_17 = (I+1)
        integer_tape(integer_tape_pointer) = OpenAD_Symbol_17
        integer_tape_pointer = integer_tape_pointer+1
        integer_tape(integer_tape_pointer) = I
        integer_tape_pointer = integer_tape_pointer+1
        OpenAD_Symbol_2 = (INT(OpenAD_Symbol_2)+INT(1_w2f__i8))
      END DO
      integer_tape(integer_tape_pointer) = OpenAD_Symbol_2
      integer_tape_pointer = integer_tape_pointer+1
      OpenAD_aux_28 = (X(7)%v*X(9)%v+1.0D00)
      OpenAD_aux_26 = EXP(X(7)%v/OpenAD_aux_28)
      OpenAD_aux_30 = (H*H)
      OpenAD_aux_29 = (X(8)%v*OpenAD_aux_30)
      OpenAD_aux_27 = (OpenAD_aux_29/1.2D+01)
      OpenAD_lin_48 = (INT(1_w2f__i8)/OpenAD_aux_28)
      OpenAD_lin_50 = X(9)%v
      OpenAD_lin_51 = X(7)%v
      OpenAD_lin_49 = (-(X(7)%v/(OpenAD_aux_28*OpenAD_aux_28)))
      OpenAD_lin_47 = OpenAD_aux_26
      OpenAD_lin_45 = OpenAD_aux_27
      OpenAD_lin_53 = OpenAD_aux_30
      OpenAD_lin_52 = (INT(1_w2f__i8)/1.2D+01)
      OpenAD_lin_46 = OpenAD_aux_26
      F(6)%v = (X(7)%v+F(6)%v+OpenAD_aux_26*OpenAD_aux_27)
      OpenAD_acc_30 = (OpenAD_lin_47*OpenAD_lin_45)
      OpenAD_acc_31 = (OpenAD_lin_53*OpenAD_lin_52*OpenAD_lin_46)
      OpenAD_acc_32 = (OpenAD_lin_48*OpenAD_acc_30)
      OpenAD_acc_33 = (OpenAD_lin_49*OpenAD_acc_30)
      OpenAD_acc_34 = (OpenAD_lin_50*OpenAD_acc_33)
      OpenAD_acc_35 = (OpenAD_lin_51*OpenAD_acc_33)
      double_tape(double_tape_pointer) = OpenAD_acc_31
      double_tape_pointer = double_tape_pointer+1
      double_tape(double_tape_pointer) = OpenAD_acc_32
      double_tape_pointer = double_tape_pointer+1
      double_tape(double_tape_pointer) = OpenAD_acc_34
      double_tape_pointer = double_tape_pointer+1
      double_tape(double_tape_pointer) = OpenAD_acc_35
      double_tape_pointer = double_tape_pointer+1
      F(7)%v = (F(7)%v-X(7)%v*2.0D00)
      OpenAD_aux_34 = (H*H)
      OpenAD_aux_33 = (X(8)%v*OpenAD_aux_34)
      OpenAD_aux_31 = (OpenAD_aux_33/1.2D+01)
      OpenAD_aux_36 = (X(7)%v*X(9)%v+1.0D00)
      OpenAD_aux_35 = EXP(X(7)%v/OpenAD_aux_36)
      OpenAD_aux_32 = (OpenAD_aux_35*1.0D+01+1.0D00)
      OpenAD_lin_57 = OpenAD_aux_34
      OpenAD_lin_56 = (INT(1_w2f__i8)/1.2D+01)
      OpenAD_lin_54 = OpenAD_aux_32
      OpenAD_lin_59 = (INT(1_w2f__i8)/OpenAD_aux_36)
      OpenAD_lin_61 = X(9)%v
      OpenAD_lin_62 = X(7)%v
      OpenAD_lin_60 = (-(X(7)%v/(OpenAD_aux_36*OpenAD_aux_36)))
      OpenAD_lin_58 = OpenAD_aux_35
      OpenAD_lin_55 = OpenAD_aux_31
      F(7)%v = (F(7)%v+OpenAD_aux_31*OpenAD_aux_32)
      OpenAD_acc_36 = (OpenAD_lin_58*1.0D+01)
      OpenAD_acc_37 = (OpenAD_lin_57*OpenAD_lin_56*OpenAD_lin_54)
      OpenAD_acc_38 = (OpenAD_lin_59*OpenAD_acc_36*OpenAD_lin_55)
      OpenAD_acc_39 = (OpenAD_lin_60*OpenAD_acc_36*OpenAD_lin_55)
      OpenAD_acc_40 = (OpenAD_lin_61*OpenAD_acc_39)
      OpenAD_acc_41 = (OpenAD_lin_62*OpenAD_acc_39)
      double_tape(double_tape_pointer) = OpenAD_acc_37
      double_tape_pointer = double_tape_pointer+1
      double_tape(double_tape_pointer) = OpenAD_acc_38
      double_tape_pointer = double_tape_pointer+1
      double_tape(double_tape_pointer) = OpenAD_acc_40
      double_tape_pointer = double_tape_pointer+1
      double_tape(double_tape_pointer) = OpenAD_acc_41
      double_tape_pointer = double_tape_pointer+1

C taping end
            our_rev_mode%arg_store=.FALSE.
            our_rev_mode%arg_restore=.FALSE.
            our_rev_mode%plain=.FALSE.
            our_rev_mode%tape=.FALSE.
            our_rev_mode%adjoint=.TRUE.
          end if
          if (our_rev_mode%adjoint) then
C            print*, " adjoint    ", our_rev_mode
            our_rev_mode%arg_store=.FALSE.
            our_rev_mode%arg_restore=.TRUE.
            our_rev_mode%plain=.FALSE.
            our_rev_mode%tape=.TRUE.
            our_rev_mode%adjoint=.FALSE.
C adjoint
      double_tape_pointer = double_tape_pointer-1
      OpenAD_Symbol_53 = double_tape(double_tape_pointer)
      double_tape_pointer = double_tape_pointer-1
      OpenAD_Symbol_54 = double_tape(double_tape_pointer)
      double_tape_pointer = double_tape_pointer-1
      OpenAD_Symbol_55 = double_tape(double_tape_pointer)
      double_tape_pointer = double_tape_pointer-1
      OpenAD_Symbol_56 = double_tape(double_tape_pointer)
      X(9)%d = X(9)%d+F(7)%d*(OpenAD_Symbol_53)
      X(7)%d = X(7)%d+F(7)%d*(OpenAD_Symbol_54)
      X(7)%d = X(7)%d+F(7)%d*(OpenAD_Symbol_55)
      X(8)%d = X(8)%d+F(7)%d*(OpenAD_Symbol_56)
      OpenAD_prp_4%d = OpenAD_prp_4%d+F(7)%d
      F(7)%d = 0.0d0
      F(7)%d = F(7)%d+OpenAD_prp_4%d
      OpenAD_prp_4%d = 0.0d0
      X(7)%d = X(7)%d+F(7)%d*(-2.0D00)
      OpenAD_prp_3%d = OpenAD_prp_3%d+F(7)%d
      F(7)%d = 0.0d0
      F(7)%d = F(7)%d+OpenAD_prp_3%d
      OpenAD_prp_3%d = 0.0d0
      double_tape_pointer = double_tape_pointer-1
      OpenAD_Symbol_57 = double_tape(double_tape_pointer)
      double_tape_pointer = double_tape_pointer-1
      OpenAD_Symbol_58 = double_tape(double_tape_pointer)
      double_tape_pointer = double_tape_pointer-1
      OpenAD_Symbol_59 = double_tape(double_tape_pointer)
      double_tape_pointer = double_tape_pointer-1
      OpenAD_Symbol_60 = double_tape(double_tape_pointer)
      X(9)%d = X(9)%d+F(6)%d*(OpenAD_Symbol_57)
      X(7)%d = X(7)%d+F(6)%d*(OpenAD_Symbol_58)
      X(7)%d = X(7)%d+F(6)%d*(OpenAD_Symbol_59)
      X(8)%d = X(8)%d+F(6)%d*(OpenAD_Symbol_60)
      OpenAD_prp_2%d = OpenAD_prp_2%d+F(6)%d
      X(7)%d = X(7)%d+F(6)%d
      F(6)%d = 0.0d0
      F(6)%d = F(6)%d+OpenAD_prp_2%d
      OpenAD_prp_2%d = 0.0d0
      integer_tape_pointer = integer_tape_pointer-1
      OpenAD_Symbol_0 = integer_tape(integer_tape_pointer)
      OpenAD_Symbol_1 = 1
      do while (INT(OpenAD_Symbol_1).LE.INT(OpenAD_Symbol_0))
        integer_tape_pointer = integer_tape_pointer-1
        OpenAD_Symbol_26 = integer_tape(integer_tape_pointer)
        double_tape_pointer = double_tape_pointer-1
        OpenAD_Symbol_27 = double_tape(double_tape_pointer)
        double_tape_pointer = double_tape_pointer-1
        OpenAD_Symbol_28 = double_tape(double_tape_pointer)
        double_tape_pointer = double_tape_pointer-1
        OpenAD_Symbol_29 = double_tape(double_tape_pointer)
        double_tape_pointer = double_tape_pointer-1
        OpenAD_Symbol_30 = double_tape(double_tape_pointer)
        integer_tape_pointer = integer_tape_pointer-1
        OpenAD_Symbol_31 = integer_tape(integer_tape_pointer)
        X(9)%d = X(9)%d+F(OpenAD_Symbol_31)%d*(OpenAD_Symbol_27)
        integer_tape_pointer = integer_tape_pointer-1
        OpenAD_Symbol_32 = integer_tape(integer_tape_pointer)
        X(OpenAD_Symbol_26)%d = X(OpenAD_Symbol_26)%d+F(OpenAD_Symbol_32
     +)%d*(OpenAD_Symbol_28)
        integer_tape_pointer = integer_tape_pointer-1
        OpenAD_Symbol_33 = integer_tape(integer_tape_pointer)
        X(OpenAD_Symbol_26)%d = X(OpenAD_Symbol_26)%d+F(OpenAD_Symbol_33
     +)%d*(OpenAD_Symbol_29)
        integer_tape_pointer = integer_tape_pointer-1
        OpenAD_Symbol_34 = integer_tape(integer_tape_pointer)
        X(8)%d = X(8)%d+F(OpenAD_Symbol_34)%d*(OpenAD_Symbol_30)
        integer_tape_pointer = integer_tape_pointer-1
        OpenAD_Symbol_35 = integer_tape(integer_tape_pointer)
        X(OpenAD_Symbol_26)%d = X(OpenAD_Symbol_26)%d+F(OpenAD_Symbol_35
     +)%d
        F(OpenAD_Symbol_35)%d = 0.0d0
        integer_tape_pointer = integer_tape_pointer-1
        OpenAD_Symbol_36 = integer_tape(integer_tape_pointer)
        double_tape_pointer = double_tape_pointer-1
        OpenAD_Symbol_37 = double_tape(double_tape_pointer)
        double_tape_pointer = double_tape_pointer-1
        OpenAD_Symbol_38 = double_tape(double_tape_pointer)
        double_tape_pointer = double_tape_pointer-1
        OpenAD_Symbol_39 = double_tape(double_tape_pointer)
        double_tape_pointer = double_tape_pointer-1
        OpenAD_Symbol_40 = double_tape(double_tape_pointer)
        X(9)%d = X(9)%d+F(OpenAD_Symbol_36)%d*(OpenAD_Symbol_37)
        X(OpenAD_Symbol_36)%d = X(OpenAD_Symbol_36)%d+F(OpenAD_Symbol_36
     +)%d*(OpenAD_Symbol_38)
        X(OpenAD_Symbol_36)%d = X(OpenAD_Symbol_36)%d+F(OpenAD_Symbol_36
     +)%d*(OpenAD_Symbol_39)
        X(8)%d = X(8)%d+F(OpenAD_Symbol_36)%d*(OpenAD_Symbol_40)
        X(OpenAD_Symbol_36)%d = X(OpenAD_Symbol_36)%d+F(OpenAD_Symbol_36
     +)%d*(-2.0D00)
        OpenAD_prp_1%d = OpenAD_prp_1%d+F(OpenAD_Symbol_36)%d
        F(OpenAD_Symbol_36)%d = 0.0d0
        F(OpenAD_Symbol_36)%d = F(OpenAD_Symbol_36)%d+OpenAD_prp_1%d
        OpenAD_prp_1%d = 0.0d0
        integer_tape_pointer = integer_tape_pointer-1
        OpenAD_Symbol_41 = integer_tape(integer_tape_pointer)
        double_tape_pointer = double_tape_pointer-1
        OpenAD_Symbol_42 = double_tape(double_tape_pointer)
        double_tape_pointer = double_tape_pointer-1
        OpenAD_Symbol_43 = double_tape(double_tape_pointer)
        double_tape_pointer = double_tape_pointer-1
        OpenAD_Symbol_44 = double_tape(double_tape_pointer)
        double_tape_pointer = double_tape_pointer-1
        OpenAD_Symbol_45 = double_tape(double_tape_pointer)
        integer_tape_pointer = integer_tape_pointer-1
        OpenAD_Symbol_46 = integer_tape(integer_tape_pointer)
        X(9)%d = X(9)%d+F(OpenAD_Symbol_46)%d*(OpenAD_Symbol_42)
        integer_tape_pointer = integer_tape_pointer-1
        OpenAD_Symbol_47 = integer_tape(integer_tape_pointer)
        X(OpenAD_Symbol_41)%d = X(OpenAD_Symbol_41)%d+F(OpenAD_Symbol_47
     +)%d*(OpenAD_Symbol_43)
        integer_tape_pointer = integer_tape_pointer-1
        OpenAD_Symbol_48 = integer_tape(integer_tape_pointer)
        X(OpenAD_Symbol_41)%d = X(OpenAD_Symbol_41)%d+F(OpenAD_Symbol_48
     +)%d*(OpenAD_Symbol_44)
        integer_tape_pointer = integer_tape_pointer-1
        OpenAD_Symbol_49 = integer_tape(integer_tape_pointer)
        X(8)%d = X(8)%d+F(OpenAD_Symbol_49)%d*(OpenAD_Symbol_45)
        integer_tape_pointer = integer_tape_pointer-1
        OpenAD_Symbol_50 = integer_tape(integer_tape_pointer)
        OpenAD_prp_0%d = OpenAD_prp_0%d+F(OpenAD_Symbol_50)%d
        integer_tape_pointer = integer_tape_pointer-1
        OpenAD_Symbol_51 = integer_tape(integer_tape_pointer)
        X(OpenAD_Symbol_41)%d = X(OpenAD_Symbol_41)%d+F(OpenAD_Symbol_51
     +)%d
        F(OpenAD_Symbol_51)%d = 0.0d0
        integer_tape_pointer = integer_tape_pointer-1
        OpenAD_Symbol_52 = integer_tape(integer_tape_pointer)
        F(OpenAD_Symbol_52)%d = F(OpenAD_Symbol_52)%d+OpenAD_prp_0%d
        OpenAD_prp_0%d = 0.0d0
        OpenAD_Symbol_1 = INT(OpenAD_Symbol_1)+1
      END DO
      double_tape_pointer = double_tape_pointer-1
      OpenAD_Symbol_18 = double_tape(double_tape_pointer)
      double_tape_pointer = double_tape_pointer-1
      OpenAD_Symbol_19 = double_tape(double_tape_pointer)
      double_tape_pointer = double_tape_pointer-1
      OpenAD_Symbol_20 = double_tape(double_tape_pointer)
      double_tape_pointer = double_tape_pointer-1
      OpenAD_Symbol_21 = double_tape(double_tape_pointer)
      X(9)%d = X(9)%d+F(2)%d*(OpenAD_Symbol_18)
      X(1)%d = X(1)%d+F(2)%d*(OpenAD_Symbol_19)
      X(1)%d = X(1)%d+F(2)%d*(OpenAD_Symbol_20)
      X(8)%d = X(8)%d+F(2)%d*(OpenAD_Symbol_21)
      X(1)%d = X(1)%d+F(2)%d
      F(2)%d = 0.0d0
      double_tape_pointer = double_tape_pointer-1
      OpenAD_Symbol_22 = double_tape(double_tape_pointer)
      double_tape_pointer = double_tape_pointer-1
      OpenAD_Symbol_23 = double_tape(double_tape_pointer)
      double_tape_pointer = double_tape_pointer-1
      OpenAD_Symbol_24 = double_tape(double_tape_pointer)
      double_tape_pointer = double_tape_pointer-1
      OpenAD_Symbol_25 = double_tape(double_tape_pointer)
      X(9)%d = X(9)%d+F(1)%d*(OpenAD_Symbol_22)
      X(1)%d = X(1)%d+F(1)%d*(OpenAD_Symbol_23)
      X(1)%d = X(1)%d+F(1)%d*(OpenAD_Symbol_24)
      X(8)%d = X(8)%d+F(1)%d*(OpenAD_Symbol_25)
      X(1)%d = X(1)%d+F(1)%d*(-2.0D00)
      F(1)%d = 0.0d0

C adjoint end
            our_rev_mode%arg_store=.FALSE.
            our_rev_mode%arg_restore=.TRUE.
            our_rev_mode%plain=.FALSE.
            our_rev_mode%tape=.TRUE.
            our_rev_mode%adjoint=.FALSE.
          end if
        end subroutine head
